package com.example.demo.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Data
public class UserDto {
    // 必填
    @NotBlank(message = "名字非法")
    @Size(min = 3, max = 12, message = "名字长度在3-12之间")
    private String name;

    // 非必填  250
    @Range(min = 0, max = 250, message = "年龄必须在0-250之间")
    private Integer age;

}